package com.shop.front.dao.realname;

import com.shop.jpa.BaseDao;
import com.shop.domain.user.UserRealNameAuth;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRealNameAuthDao extends BaseDao<UserRealNameAuth, Long> {

    @Query("select count(*) from UserRealNameAuth where uid = ?1 and createTime >= concat(?2,' 00:00:00') and createTime <= concat(?2,' 23:59:59')")
    int countByUidAndDate(Long userId, String todayStr);

    @Query("select count(*) from UserRealNameAuth where ip = ?1 and createTime >= concat(?2,' 00:00:00') and createTime <= concat(?2,' 23:59:59')")
    int countByIpAndDate(String ip, String todayStr);

    @Query("select count(*) from UserRealNameAuth where isSuccess = 1 and realityName = ?1 and idNumber = ?2")
    int countByAuthSuccess(String realName, String idcard);

}
